package models

//通用结构表
type BaseModel struct {
	ID        uint  `gorm:"primarykey;autoIncrement" json:"id"`
	CreatedAt int64 `gorm:"comment:创建时间" json:"created_at"`
	UpdatedAt int64 `gorm:"comment:更新时间" json:"updated_at"`
	DeletedAt int64 `gorm:"comment:删除时间" json:"deleted_at"`
	IsDeleted int   `gorm:"comment:是否删除 1:是 0:否" json:"is_deleted"`
}

// User 用户表结构
type User struct {
	Username string `gorm:"type:varchar(50);uniqueIndex;not null;comment:用户名" json:"username"`
	Password string `gorm:"type:varchar(255);not null;comment:密码" json:"password"`
	Email    string `gorm:"type:varchar(100);uniqueIndex;comment:邮箱" json:"email"`
	Phone    string `gorm:"type:varchar(20);comment:手机号" json:"phone"`
	Nickname string `gorm:"type:varchar(50);comment:昵称" json:"nickname"`
	Avatar   string `gorm:"type:varchar(255);comment:头像URL" json:"avatar"`
	Status   int    `gorm:"type:tinyint;default:1;comment:状态 1:正常 0:禁用" json:"status"`
	Role     string `gorm:"type:varchar(20);default:'user';comment:角色" json:"role"`
	BaseModel
}

// TableName 指定表名
func (User) TableName() string {
	return "user"
}

//推荐问题表
type RecommendQuestion struct {
	BaseModel
	Question string `gorm:"type:varchar(255);not null;comment:问题" json:"question"`
}

// TableName 指定表名
func (RecommendQuestion) TableName() string {
	return "recommend_question"
}

//反馈问题表
type FeedbackQuestion struct {
	BaseModel
	FeedbackType      int    `gorm:"type:tinyint;not null;comment:反馈类型(1、问题反馈,2、界面优化,3、体验问题,4、其他)" json:"feedback_type"`
	FeedbackContent   string `gorm:"type:varchar(255);not null;comment:反馈内容" json:"feedback_content"`
	FeedbackUserPhone string `gorm:"type:varchar(255);not null;comment:反馈用户手机号" json:"feedback_user_phone"`
	FeedbackImg       string `gorm:"type:varchar(255);not null;comment:反馈图片" json:"feedback_img"`
	UserID            uint   `gorm:"type:int;not null;comment:用户ID" json:"user_id"`
	User              User   `gorm:"foreignKey:UserID;references:ID" json:"user"`
}

// TableName 指定表名
func (FeedbackQuestion) TableName() string {
	return "feedback_question"
}

//政策文件表
type PolicyFile struct {
	BaseModel
	PolicyName    string `gorm:"type:varchar(255);not null;comment:政策名称" json:"policy_name"`
	PolicyContent string `gorm:"type:varchar(255);not null;comment:政策内容" json:"policy_content"`
	PolicyType    int    `gorm:"type:tinyint;not null;comment:政策类型(0、全部,1、国家法规,2、行业法规,3、地方法规,4、内部条例)" json:"policy_type"`
	PolicyFileUrl string `gorm:"type:varchar(255);not null;comment:政策文件URL" json:"policy_file_url"`
	//政策部门
	PolicyDepartment string `gorm:"type:varchar(255);not null;comment:政策部门" json:"policy_department"`
	//查看次数
	ViewCount int `gorm:"type:int;not null;comment:查看次数" json:"view_count"`
	//文件类型
	FileType int `gorm:"type:tinyint;not null;comment:文件类型(0、pdf,1、word,2、excel,3、ppt,4、txt,5、其他)" json:"file_type"`
	//文件标签
	FileTag string `gorm:"type:varchar(255);not null;comment:文件标签" json:"file_tag"`
	//颁布时间
	PublishTime int64 `gorm:"type:int;not null;comment:颁布时间" json:"publish_time"`
}

// TableName 指定表名
func (PolicyFile) TableName() string {
	return "policy_file"
}

//AI问答和安全培训功能卡片表
type FunctionCard struct {
	BaseModel	
	FunctionTitle string `gorm:"type:varchar(255);not null;comment:功能标题" json:"function_title"`
	FunctionType int    `gorm:"type:tinyint;not null;comment:功能类型(0、AI问答,1、安全培训)" json:"function_type"`
	FunctionContent string `gorm:"type:varchar(255);not null;comment:功能内容" json:"function_content"`
	//图标
	FunctionIcon string `gorm:"type:varchar(255);not null;comment:图标" json:"function_icon"`
}

// TableName 指定表名
func (FunctionCard) TableName() string {
	return "function_card"
}

//AI问答和安全培训底部热点问题表
type HotQuestion struct {
	BaseModel
	Question string `gorm:"type:varchar(255);not null;comment:问题" json:"question"`
	QuestionType int    `gorm:"type:tinyint;not null;comment:问题类型(0、AI问答,1、安全培训)" json:"question_type"`
	//图标
	QuestionIcon string `gorm:"type:varchar(255);not null;comment:图标" json:"question_icon"`
}

// TableName 指定表名
func (HotQuestion) TableName() string {
	return "hot_question"
}